﻿namespace WMS6.Services
{
    using System;
    using System.ServiceModel.Activation;
    using WMS6.BLL;
    using WMS6.Common;
    using WMS6.DataEntity;

    [AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
    public class LoginService : ILoginService
    {
        public PreferenceProfileInfo GetPreferenceProfileByUserID(string userID)
        {
            try
            {
                UserPreferenceBLL userPreference = new UserPreferenceBLL();
                return userPreference.GetPreferenceProfileByUserID(userID);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "BaseInfoService异常");
            }
            return null;
        }

        public UserMstInfo GetUserInfoByID(string userID)
        {
            try
            {
                return (BaseInfoFactory.CreateInstance("USER_MST", null).GetInfoByID(userID) as UserMstInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "BaseInfoService异常");
            }
            return null;
        }

        public void InsertSysLoginLogInfo(SysLoginLogInfo sysLoginLogInfo)
        {
            try
            {
                new SysLoginLogBLL().InsertSysLoginLogInfo(sysLoginLogInfo);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "BaseInfoService异常");
            }
        }

        public string InsertUserPreference(PreferenceProfileInfo preferencePrifile)
        {
            try
            {
                UserPreferenceBLL userPreference = new UserPreferenceBLL();
                return userPreference.InsertUserPreference(preferencePrifile);
            }
            catch (Exception ex)
            {
                CommonErrorHandler.ErrorTypeExchange(ex, "BaseInfoService异常");
            }
            return null;
        }
    }
}

